﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using LetLord.Models;
using System.ComponentModel.DataAnnotations;

namespace LetLord.ViewModels
{
    public class CreatePropertyViewModel
    {
        // Address model properties
        [Required(ErrorMessage="This is required")]
        public string Line1 { get; set; }
        public string Line2 { get; set; }
        [Required]
        public string TownCity { get; set; }
        [Required]
        public string County { get; set; }
        [Required]
        public string PostCode { get; set; }

        // ResidentialProperty model properties
        [Required]
        public PropertyType PropertyType { get; set; }
        [Required]
        public string SizeSquareMeters { get; set; }
        [Required]
        public string NumberOfBedrooms { get; set; }
        [Required]
        public string NumberOfBathrooms { get; set; }
        [Required]
        public string NumberOfReceptionRooms { get; set; }
        [Required]
        public decimal MonthlyRate { get; set; }
        public string Description { get; set; }
        public bool HasBackGarden { get; set; }
        public bool HasFrontGarden { get; set; }
        public bool IsDisabledFriendly { get; set; }
        public bool HasSecureParking { get; set; }

        public virtual string PropertyTypeString
        {
            get { return PropertyType.ToString(); }
            set
            {
                PropertyType newValue;
                if (Enum.TryParse(value, out newValue))
                { PropertyType = newValue; }
            }
        }
    }
}